package com.yuexunit.operationman.nbsy.module.Patients.ui;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.BaseKJActivity;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.Catheter.ui.Act_Catheter_Main;
import com.yuexunit.operationman.nbsy.module.DisarmTrap.ui.Act_DisarmTrap_Main;
import com.yuexunit.operationman.nbsy.module.InterventionalOperation.ui.Act_InterventionalOperation_Main;
import com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.ui.Act_OperationBeforeAndAfter_Main;
import com.yuexunit.operationman.nbsy.module.OperationInventory.ui.Act_OperationInventory_Main;
import com.yuexunit.operationman.nbsy.module.OperationRiskAssessment.ui.Act_RiskAssessmentMain;
import com.yuexunit.operationman.nbsy.module.Placement.ui.Act_Placement_Main;
import com.yuexunit.operationman.nbsy.module.SafeOperation.ui.Act_SafeOperationMain;
import com.yuexunit.operationman.nbsy.module.SurgicalReceipt.ui.Act_SurgicalReceipt_Main;
import com.yuexunit.operationman.nbsy.module.nurse.ui.Act_Nursing;

import org.kymjs.kjframe.utils.PreferenceHelper;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by work-jx on 2017/2/28.
 */
public class Act_PatientDetail extends BaseKJActivity {

    @Bind(R.id.patient_pic)
    ImageView patientPic;
    @Bind(R.id.patient_name)
    TextView patientName;
    @Bind(R.id.patient_age)
    TextView patientAge;
    @Bind(R.id.patient_sex)
    TextView patientSex;
    @Bind(R.id.patient_date)
    TextView patientDate;
    @Bind(R.id.patient_order_date)
    TextView patientOrderDate;
    @Bind(R.id.patient_doc)
    TextView patientDoc;
    @Bind(R.id.patient_bed)
    TextView patientBed;
    @Bind(R.id.patient_diagnose)
    TextView patientDiagnose;
    @Bind(R.id.patient_hospital)
    TextView patientHospital;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_patientdetail);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        patientName.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_NAME));
        patientAge.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_AGE));
        patientDate.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DATE));
        patientDoc.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DOCTOR));
        patientBed.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_BED));
        patientDiagnose.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DIAGNOSIS));
        patientHospital.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_VISITNO));
        patientOrderDate.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_ORDER_TIME));

        if (PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_SEX).equals("1"))
        {
            patientSex.setText("男");
        }
        else if(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_SEX).equals("2"))
        {
            patientSex.setText("女");
        }
        else {
            patientSex.setText("不详");
        }
    }

    @OnClick({R.id.titlebar_img_back, R.id.find_plugin_1, R.id.find_plugin_2, R.id.find_plugin_3,
            R.id.find_plugin_4, R.id.find_plugin_5, R.id.find_plugin_6, R.id.find_plugin_7, R.id.find_plugin_8,
            R.id.find_plugin_9, R.id.find_plugin_10, R.id.find_plugin_11, R.id.find_plugin_12})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.titlebar_img_back:
                finish();
                break;
            case R.id.find_plugin_1:
                startActivity(new Intent(aty, Act_SurgicalReceipt_Main.class));
                break;
            case R.id.find_plugin_2:
//                startActivity(new Intent(aty, Act_BeforeAnesthesiaMain.class));
                break;
            case R.id.find_plugin_3:
                startActivity(new Intent(aty, Act_SafeOperationMain.class));
                break;
            case R.id.find_plugin_4:
                startActivity(new Intent(aty, Act_RiskAssessmentMain.class));
                break;
            case R.id.find_plugin_5:
                startActivity(new Intent(aty, Act_Nursing.class));
                break;
            case R.id.find_plugin_6:
                startActivity(new Intent(aty, Act_OperationInventory_Main.class));
                break;
            case R.id.find_plugin_7:
//                startActivity(new Intent(aty, Act_AfterOperationMain.class));
                break;
            case R.id.find_plugin_8:
                startActivity(new Intent(aty, Act_InterventionalOperation_Main.class));
                break;
            case R.id.find_plugin_9:
//                ViewInject.toast("开发中");
                startActivity(new Intent(aty, Act_DisarmTrap_Main.class));
                break;
            case R.id.find_plugin_10:
//                ViewInject.toast("开发中");
                startActivity(new Intent(aty, Act_Placement_Main.class));
                break;
            case R.id.find_plugin_11:
                startActivity(new Intent(aty, Act_OperationBeforeAndAfter_Main.class));
                break;
            case R.id.find_plugin_12:
                startActivity(new Intent(aty, Act_Catheter_Main.class));
                break;
        }
    }
}
